﻿CREATE TABLE [dbo].[blog] (
    [blog_id]                  BIGINT          IDENTITY (1, 1) NOT NULL,
    [blog_name]                NVARCHAR (50)   NOT NULL,
    [blog_url]                 VARCHAR (255)   NOT NULL,
    [rss_url]                  VARCHAR (255)   NOT NULL,
    [first_post_date]          SMALLDATETIME   NOT NULL,
    [description]              NVARCHAR (2000) NOT NULL,
    [publishing_state_id]      BIGINT          NOT NULL,
    [publishing_state_date]    DATETIME        NOT NULL,
    [publishing_state_comment] NVARCHAR (255)  NULL,
    [publishing_state_by_id]   BIGINT          NOT NULL,
    [created]                  DATETIME        NOT NULL,
    [created_by_id]            BIGINT          NOT NULL,
    CONSTRAINT [PK_blog] PRIMARY KEY CLUSTERED ([blog_id] ASC),
    CONSTRAINT [FK_blog_publish_state] FOREIGN KEY ([publishing_state_id]) REFERENCES [dbo].[publish_state] ([publish_state_id]),
    CONSTRAINT [FK_blog_users] FOREIGN KEY ([publishing_state_by_id]) REFERENCES [dbo].[users] ([user_id]),
    CONSTRAINT [FK_blog_users1] FOREIGN KEY ([created_by_id]) REFERENCES [dbo].[users] ([user_id])
);





